package com.leo.client;

import java.net.Socket;
import java.util.Date;

/**
 * @ClassName IOClient
 * @Description
 * @Author wangss
 * @date 2022.03.17 20:20
 * @Version 1.0
 */
public class IOClient2 {
    public static void main(String[] args) {
        new Thread(() ->{
            try {
                Socket socket = new Socket("127.0.0.1", 8000);
                while (true) {
                    socket.getOutputStream().write((new Date() + ": hello world2").getBytes());
                    Thread.sleep(5000);
                }
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }).start();
    }
}
